package slojenie;

public class slojenie {
	public static int[] mar1;
	public static int[] mar2;
	public static int[] mar3;
	public static int shirina=5;
	public static int n=0;
	
	public static void create()
	{

	for(int i=1;i<shirina;i++)
	{
		mar1[i]=(int) (Math.random() * 9);
	}
	for(int i=0;i<shirina-1;i++)
	{
		mar2[i]=(int) (Math.random() * 9);
	}
	}
		public static void	print()
		    {
			for(int i=0;i<shirina;i++){
				System.out.print(mar1[i]);
			}
			System.out.println();
			for(int i=0;i<shirina;i++)
			{
				System.out.print(mar2[i]);
			}
			System.out.println();
			for(int i=0;i<shirina;i++)
			{
				System.out.print(mar3[i]);
			}
		}
		public static void sloj()
		{
			for(int i=shirina-1;i>=0;i--)
			{
				mar3[i]=mar1[i]+mar2[i]+n;
				n=0;
				if(mar3[i]>=10)
				{
					mar3[i]=mar3[i]%10;
					n=1;
				}
				}
			}
	public static void main(String[] args) 
	{
		 mar1 = new int[shirina];
		 mar2 = new int[shirina];
		 mar3 = new int[shirina];
		create();
		sloj();
		print();
	
	}
}


